-
-
Couldn't load subscription status.
- Fork 33.2k
gh-125767: Fix pickling and copying of super objects #125781
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Previously, copying a super object returned a copy of the instance invoking super(). Pickling a super object could pickle the instance invoking super() or fail, depending on its type and protocol. Now deep copying returns a new super object and pickling pickles the super object. Shallow copying returns the same super object.
Misc/NEWS.d/next/Library/2024-10-21-13-52-37.gh-issue-125767.0kK4lX.rst
Outdated
Show resolved
Hide resolved
Co-authored-by: Jelle Zijlstra <[email protected]>
|
|
||
| pickle(type(int | str), pickle_union) | ||
|
|
||
| def pickle_super(obj): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we give this a private name? All the existing ones also use public names, so I don't mind keeping this one public too.
|
Thank you for your suggestions and review @JelleZijlstra. |
…125781) Previously, copying a super object returned a copy of the instance invoking super(). Pickling a super object could pickle the instance invoking super() or fail, depending on its type and protocol. Now deep copying returns a new super object and pickling pickles the super object. Shallow copying returns the same super object.
Previously, copying a super object returned a copy of the instance invoking super(). Pickling a super object could pickle the instance invoking super() or fail, depending on its type and protocol.
Now deep copying returns a new super object and pickling pickles the super object. Shallow copying returns the same super object.
📚 Documentation preview 📚: https://cpython-previews--125781.org.readthedocs.build/